]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
power: Make sure we fall back to the correct icon
authorFlorian Müllner <fmuellner@gnome.org>
Mon, 15 Jul 2019 22:37:13 +0000 (00:37 +0200)
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Fri, 19 Jul 2019 19:11:37 +0000 (19:11 +0000)
Commit bd18313d12 changed to a new naming scheme for battery icons,
and used to old icon names as fallback-icon-name for compatibility
with older/other icon themes.

However that fallback code isn't working correctly, as GThemedIcon's
default fallbacks will transform a name of `battery-level-90-symbolic`
to a list of names:
 - `battery-level-90-symbolic`
 - `battery-level-symbolic`
 - `battery-symbolic`

The last one frequently exists, so instead of the intended fallback,
we end up with a generic battery icon.

Address this by specifying the icon as GIcon instead of an icon-name,
where we have more control over how the icon is resolved.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1442

js/ui/status/power.js

index 8ffb0c631784dc2f040d39aadd9a577d9736403d..54475d0292124231e5f499dd9b1cf973b3a607cb 100644 (file)
@@ -114,8 +114,15 @@ var Indicator = class extends PanelMenu.SystemIndicator {
             ? 'battery-level-100-charged-symbolic'
             : `battery-level-${fillLevel}${chargingState}-symbolic`;
 
-        this._indicator.icon_name = icon;
-        this._item.icon.icon_name = icon;
+        // Make sure we fall back to fallback-icon-name and not GThemedIcon's
+        // default fallbacks
+        let gicon = new Gio.ThemedIcon({
+            name: icon,
+            use_default_fallbacks: false
+        });
+
+        this._indicator.gicon = gicon;
+        this._item.icon.gicon = gicon;
 
         let fallbackIcon = this._proxy.IconName;
         this._indicator.fallback_icon_name = fallbackIcon;